Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 17, 2025

Problem

The Maven build shortcut (Alt+Shift+X+M) stopped working in Eclipse 2023-09 and later versions, although it worked correctly in Eclipse 2023-06. Users could no longer trigger Maven builds using the keyboard shortcut, forcing them to use context menus or the Run menu instead.

Root Cause

The plugin.xml defined commands and keybindings for Maven shortcuts, but there were no handlers registered to execute these commands. Without handlers, Eclipse had no code to run when users pressed the keyboard shortcuts, causing them to silently fail.

<!-- Commands and keybindings existed -->
<command id="org.eclipse.m2e.core.pomFileAction.run" ... />
<key sequence="M3+M2+X M" commandId="org.eclipse.m2e.core.pomFileAction.run" ... />

<!-- But NO handler was registered! -->

Solution

This PR adds a new MavenLaunchShortcutHandler that implements the command handlers and registers them in plugin.xml. The handler provides behavior similar to Eclipse's "Re-run last launch" (Ctrl+F11), but specifically for Maven builds:

  1. Re-runs the most recent Maven launch: When Alt+Shift+X+M is pressed, the handler searches the launch history for the most recently executed Maven build configuration and re-launches it.

  2. Falls back to dialog: If no previous Maven launch exists in the history, it opens the Maven launch configuration dialog to create a new one.

  3. Supports goal-specific shortcuts: The implementation also enables keyboard shortcuts for specific Maven lifecycle goals (clean, install, test, generate-sources).

Changes

New File: MavenLaunchShortcutHandler.java

  • Implements AbstractHandler to handle Eclipse command execution
  • Implements IExecutableExtension to support parameterized handlers (e.g., clean, install, etc.)
  • Queries Eclipse launch history to find the most recent Maven launch configuration
  • Delegates to existing ExecutePomAction for dialog-based launches when needed

Updated: plugin.xml

  • Added handler registrations for 5 Maven commands:
    • org.eclipse.m2e.core.pomFileAction.run (general Maven build - Alt+Shift+X+M)
    • org.eclipse.m2e.actions.LifeCycleInstall.run
    • org.eclipse.m2e.actions.LifeCycleClean.run
    • org.eclipse.m2e.actions.LifeCycleTest.run
    • org.eclipse.m2e.actions.LifeCycleGenerateSources.run

Testing

The implementation can be tested by:

  1. Creating a Maven project with a pom.xml
  2. Running a Maven build (e.g., "Maven install" from context menu)
  3. Pressing Alt+Shift+X+M - the previous build should re-run
  4. On a fresh workspace with no launch history, pressing Alt+Shift+X+M should open the launch dialog

Fixes #[issue number]

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cbi.eclipse.org
    • Triggering command: curl -o org/fusesource/jansi/internal/native/Mac/arm64/libjansi.jnilib -F file=@org/fusesource/jansi/internal/native/Mac/arm64/libjansi.jnilib-tosign REDACTED (dns block)
    • Triggering command: curl -o org/fusesource/jansi/internal/native/Mac/x86/libjansi.jnilib -F file=@org/fusesource/jansi/internal/native/Mac/x86/libjansi.jnilib-tosign REDACTED (dns block)
    • Triggering command: curl -o org/fusesource/jansi/internal/native/Mac/x86_64/libjansi.jnilib -F file=@org/fusesource/jansi/internal/native/Mac/x86_64/libjansi.jnilib-tosign REDACTED (dns block)
  • repo.eclipse.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.11/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.11/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.11 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.11/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/m2e-core/m2e-core org.codehaus.plexus.classworlds.launcher.Launcher clean install -DskipTests -T 1C (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.11/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.11/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.11 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.11/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/m2e-core/m2e-core org.codehaus.plexus.classworlds.launcher.Launcher -f pom.xml -B -V -e -Dfindbugs.skip -Dcheckstyle.skip -Dpmd.skip=true -Dspotbugs.skip -Denforcer.skip -Dmaven.javadoc.skip -DskipTests -Dmaven.test.skip.exec -Dlicense.skip=true -Drat.skip=true -Dspotless.check.skip=true -s /home/REDACTED/work/m2e-core/.codeql-scratch/dbs/java/working/settings.xml com.github.ferstl:depgraph-maven-plugin:4.0.3-CodeQL:graph -B -DclasspathScopes=compile -DoutputDirectory=/home/REDACTED/work/m2e-core/.codeql-scratch/dbs/java/working/java-standalone-dependency-graph2342849966494729795/${project.groupId}/${project.artifactId} -DgraphFormat=json -Dmaven.ext.class.path=/opt/hostedtoolcache/CodeQL/2.23.1/x64/codeql/java/tools/java-buildless-maven-plugin.jar (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Maven build shortcut not working</issue_title>
<issue_description>In eclipse 2023-06 the maven build shortcut (alt+shift+x+m) is ok, mas upgrande to version 2023-09 and 2023-12 the shortcut doesnt work anymore.</issue_description>

<agent_instructions>Instead of using the previous way to start the build by a Shortcut instead we want to register a keybinding that can be used to start the most recent maven launch. At best it works as close as possible like with the old launch shortcut.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@laeubi Please provide a fix, the most suitable one seems to assign the shortcut to the Dialog oriented one then ...

If one would create 50+ maven run configs for one project (unlikely but possible) the Menu would explode

You can always abuse a feature, though we try to support the common case not the one that makes use of unrealistic corner cases.</comment_new>
<comment_new>@laeubi
Please share a screenshot then, there was no button removed, just a Menu item, that menu items also usually have no dialog unless you have no run config (what the existing one would show), the shortcut can simply made to run the last selected run config though it does not need to always create a new one.

As you already mentioned to many items can 'blow up' the thing so we should not add items that are already there.</comment_new>
<comment_new>@laeubi
@mickaelistria is it possible to have a shortcut but still not show the menu item? I think I have seen it that one can even make it somehow configurable in the perspective preferences.</comment_new>
<comment_new>@kwin
As long as there is no other way to trigger a build via a shortcut I would also opt for restoring the menu item. Although it might be redundant, this is less of an issue IMHO as having no build shortcut. Also having a shortcut without an item reduces visibility of it. @laeubi Are you fine with that?</comment_new>

Fixes #1618


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix maven build shortcut for Eclipse 2023-09 and 2023-12 Fix Maven build shortcut (Alt+Shift+X+M) not working since Eclipse 2023-09 Oct 17, 2025
Copilot AI requested a review from laeubi October 17, 2025 14:20
@laeubi laeubi mentioned this pull request Oct 17, 2025
@laeubi
Copy link
Member

laeubi commented Oct 26, 2025

Fixed by #2073

@laeubi laeubi closed this Oct 26, 2025
@HannesWell HannesWell deleted the copilot/fix-maven-build-shortcut branch November 24, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maven build shortcut not working

2 participants